#include <bits/stdc++.h>
#define ll long long
#define db double
using namespace std;

const int Maxn=2e6+7;
struct point{
    db x,y;
    point(db x=0,db y=0):x(x),y(y){}
};
db ans;
db hei[Maxn];
int n;
int h[Maxn],r[Maxn],R[Maxn];

int main(){
    freopen("wan.in","r",stdin);
    freopen("wan.out","w",stdout);
    scanf("%d",&n);

    point q1,q2,q3,q4;
    for(int i=1;i<=n;i++){
        scanf("%d%d%d",&h[i],&r[i],&R[i]);
        
        if(i==1){
            db c1=r[i]*1./2,c2=R[i]*1./2;
            q1=point(-c1,0);
            q2=point(c1,0);
            q3=point(-c2,h[i]);
            q4=point(c2,h[i]);
            hei[1]=h[1];
        }
        else{
            if(r[i]>=R[i-1]){
                ans=max(ans,hei[i-1]+h[i]);
            }
            ans+=h[i];
        }
    }
    printf("%.6lf",ans);

    return 0;
}